package com.cxh.rmsq.ui.adapter.self

import android.content.Intent
import android.text.TextUtils
import android.widget.TextView
import androidx.core.view.isVisible
import com.blankj.utilcode.util.TimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cxh.rmsq.R
import com.cxh.rmsq.common.IntentExtra
import com.cxh.rmsq.db.model.CommunityContent
import com.cxh.rmsq.db.model.InviteChildren
import com.cxh.rmsq.ui.activity.self.CommentDetailActivity
import com.cxh.rmsq.ui.activity.self.LookUserDetailActivity2
import com.cxh.rmsq.ui.widget.SelectableRoundedImageView
import com.cxh.rmsq.utils.loadImage


/**
 *
 */
class InviteListAdapter(type: Int) :
    BaseQuickAdapter<InviteChildren, BaseViewHolder>(R.layout.item_invite_list),
    LoadMoreModule {

    override fun convert(holder: BaseViewHolder, item: InviteChildren) {
        with(holder) {

            setText(R.id.tv_name, item.inviteByNickname)
            setText(
                    R.id.tv_time, TimeUtils.millis2String(item.inviteByCreateTime,"yyyy-MM-dd")
                )

            loadImage(
                item.inviteByAvatar,
                holder.getView<SelectableRoundedImageView>(R.id.siv_header)
            )
            holder.itemView.setOnClickListener {
                val intent = Intent(context, CommentDetailActivity::class.java)
                intent.putExtra("id", item.inviteById.toString())
                context.startActivity(intent)
            }
        }
    }

}